/*
 * AcadToSylfaen.java
 *
 * Created on February 22, 2006, 2:48 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package ge.ktools;

public class AcadToSylfaen
{
    
    /** Creates a new instance of AcadToSylfaen */
    public AcadToSylfaen()
    {
    }
    
    public static void main(String args[]) throws Exception
    {
        String s = "0000001693dd63340141850000059200";
        System.out.println(s.hashCode());
         s = "541095";
         System.out.println(s.hashCode());
//        //Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
//        //Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.17:1433","tst", "576319");
//        Class.forName("oracle.jdbc.driver.OracleDriver");        
//        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:hr/sa@127.0.0.1:1521:orcl");
//        conn.setAutoCommit(false);
//        Statement stm = conn.createStatement();
//        PreparedStatement ps = conn.prepareStatement("insert into AA (ID,nam) values (?,?)");
//        File file = new File("c:/aa.txt");
//        FileOutputStream f = new FileOutputStream(file);
//        Writer out = new OutputStreamWriter(f, "UTF8");
//        String s = convertString("Tbilisi");
//        out.write(s);
//        out.write("\n Database: ");
//        
//        ps.setInt(1, 1);
//        ps.setString(2, s);
//
//     //   ps.execute();
//        conn.commit();
//        
//        ResultSet  rs = stm.executeQuery("select * from AA");
//        while (rs.next())
//        {            
//            out.write(rs.getString("nam"));
//        }
//        
//
//        conn.close();
//        out.flush();
//        out.close();
//        f.close();
    }
    public static String convertString(String s)
    {
        StringBuffer sb = new StringBuffer();
        if (s == null || s.length() == 0)
        {
            return s;
        }
        
        for (int i = 0; i < s.length();i++)
        {
            sb.append(convertChar(s.charAt(i)));
            
        }
        return sb.toString();
    }
    public static char convertChar(char c)
    {
        
        int i = Character.getNumericValue(c);
        if (i<10 || i >35)
        {
            if (c == '`')
            {
                return '\u201e';
            }
            else if (c == '~')
            {
                return '\u201d';
            }
            else
            {
                return c;
            }
        }
        boolean b = Character.isLowerCase(c);
        switch (i)
        {
            case 10:
                if (b)
                {
                    return '\u10d0';
                }
                else
                {
                    return c;
                }
            case 11:
                if (b)
                {
                    return '\u10d1';
                }
                else
                {
                    return c;
                }
            case 12: // c
                if (b)
                {
                    return '\u10ea';
                }
                else
                {
                    return '\u10e9';
                }
            case 13: //d
                if (b)
                {
                    return '\u10d3';
                }
                else
                {
                    return c;
                }
            case 14:
                if (b)
                {
                    return '\u10d4';
                }
                else
                {
                    return c;
                }
            case 15:
                if (b)
                {
                    return '\u10e4';
                }
                else
                {
                    return c;
                }
            case 16: //g
                if (b)
                {
                    return '\u10d2';
                }
                else
                {
                    return '\u10e9';
                    
                    // return c;
                }
            case 17: //h
                if (b)
                {
                    return '\u10f0';
                }
                else
                {
                    return c;
                }
            case 18: //i
                if (b)
                {
                    return '\u10d8';
                }
                else
                {
                    return c;
                }
            case 19: //j
                if (b)
                {
                    return '\u10ef';
                }
                else
                {
                    return '\u10df';
                }
            case 20: //k
                if (b)
                {
                    return '\u10d9';
                }
                else
                {
                    return c;
                }
            case 21: //
                if (b)
                {
                    return '\u10da';
                }
                else
                {
                    return c;
                }
            case 22: //
                if (b)
                {
                    return '\u10db';
                }
                else
                {
                    return c;
                }
            case 23: //
                if (b)
                {
                    return '\u10dc';
                }
                else
                {
                    return '#';
                }
            case 24: //o
                if (b)
                {
                    return '\u10dd';
                }
                else
                {
                    return c;
                }
            case 25: //p
                if (b)
                {
                    return '\u10de';
                }
                else
                {
                    return c;
                }
            case 26: //q
                if (b)
                {
                    return '\u10e5';
                }
                else
                {
                    return c;
                }
            case 27: //r
                if (b)
                {
                    return '\u10e0';
                }
                else
                {
                    return '\u10e6';
                }
            case 28: //s
                if (b)
                {
                    return '\u10e1';
                }
                else
                {
                    return '\u10e8';
                }
            case 29: //
                if (b)
                {
                    return '\u10e2';
                }
                else
                {
                    return '\u10d7';
                }
            case 30: //u
                if (b)
                {
                    return '\u10e3';
                }
                else
                {
                    return c;
                }
            case 31: //v
                if (b)
                {
                    return '\u10d5';
                }
                else
                {
                    return c;
                }
            case 32: //w
                if (b)
                {
                    return '\u10ec';
                }
                else
                {
                    return '\u10ed';
                }
            case 33: //x
                if (b)
                {
                    return '\u10ee';
                }
                else
                {
                    return c;
                }
            case 34: //y
                if (b)
                {
                    return '\u10e7';
                }
                else
                {
                    return c;
                }
            case 35: //z
                if (b)
                {
                    return '\u10d6';
                }
                else
                {
                    return '\u10eb';
                }
                
        }
        return c;
    }
    
}
